{	Problem: http://codeforces.ru/problemset/problem/4/B
 	Verdict: Accepted
}
uses math;
var n,s,i,k:longint; a:array[1..40,1..2] of longint; b:array[0..40] of longint; r:boolean;
begin
read(n,s);
r:=true;
for i:=1 to n do read(a[i][1],a[i][2]);
for i:=1 to n do begin
  b[i]:=a[i][1];
  dec(s,a[i][1]);
end;
if s<0 then r:=false else begin
  for i:=1 to n do begin
    k:=min(s,a[i][2]-b[i]);
    inc(b[i],k);
    dec(s,k);
  end;
  if s>0 then r:=false;
end;
if r then begin
    writeln('YES');
    for i:=1 to n do write(b[i],' ');
end else write('NO');
end.